//
//  TabTweetViewController.m
//  FineNurse
//
//  Created by TT_UED on 2018/4/18.
//  Copyright © 2018年 TT_UED. All rights reserved.
//

#import "TabTweetViewController.h"
#import "AlertViewController.h"

@interface TabTweetViewController ()

@property(nonatomic ,strong) NSArray* tableViewData;

@end

@implementation TabTweetViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setBackgroundColor:UIColor.whiteColor];
    [self setTitle:@"动弹"];
    
    self.tableViewData = @[@"张飞",@"赵云",@"刘备",@"关羽",@"马超",@"孔明",@"魏延",@"姜维",@"刘禅"];
     
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    self.tableView.tableFooterView = [[UIView alloc]init];
 
    
    self.refreshControl = [[UIRefreshControl alloc] init];
    self.refreshControl.tintColor = UIColor.greenColor;
    
    //self.refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"正在加载中！"];
    
    //NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
    //attributes[NSForegroundColorAttributeName] = [UIColor greenColor];
    //attributes[NSBackgroundColorAttributeName] = [UIColor redColor];
    //attributes[NSUnderlineStyleAttributeName] = @YES;
    //self.refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"正在加载中" attributes:attributes];
    
    [self.refreshControl addTarget:self action:@selector(downloadData) forControlEvents:UIControlEventValueChanged];
    
    [self.refreshControl beginRefreshing];
    // 去下载数据，完成后调关闭方法
    [self.refreshControl endRefreshing];
    
}

- (IBAction)downloadData {
     [self.refreshControl endRefreshing];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    static NSString * ID = @"ChecklizdvdzfbdzbstItem";
    UITableViewCell * cell =[tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
        cell.textLabel.text = self.tableViewData[indexPath.row];
    }
    return cell;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return self.tableViewData.count;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   
    if( indexPath.row == 0){
        [self TestUrl];
    }
    return;
    
    UIAlertController *alert = [AlertViewController Alert:@"吩咐" callbackOkFn:^(){
          NSLog(@"1111111111");
        
        NSArray* arr = @[@"1",@"2",@"3",@"4"];
        UIAlertController *sheetsAlert = [AlertViewController AlertSheet:@"提示" message:@"abc" sheetsName:arr callbackFns:^(int index){
             NSLog(@"%@", arr[index]);            
        }];
        [self presentViewController:sheetsAlert animated:YES completion:nil];
        
    }];
    
    [self presentViewController:alert animated:YES completion:nil];
 
}

-(void) TestUrl{
    
     
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
